<?php

/*
 * Checks if the page is a parent-page or not
 *
 */

// Return json encoded data
header ('Content-type: application/json');

require_once '../core/db.php';

$sql = 'SELECT COUNT(*) AS num FROM `sitePages` WHERE parent=?';
$sth = $db->prepare ($sql);
$sth->execute (array ($_POST['id']));
$res = $sth->fetch(PDO::FETCH_ASSOC);

if ($res['num'] > 0) {
	echo json_encode (array ('val'=> true));
}
else {
    echo json_encode (array ('val'=> false));
}

?>